//
//  SymbrionRobot.h
//  symbrion
//
//  Created by Berend Weel on 4/2/13.
//  Copyright (c) 2013 Berend Weel. All rights reserved.
//

#ifndef symbrion_SymbrionRobot_h
#define symbrion_SymbrionRobot_h

#include <vector>

#include "RobotType.h"

class SymbrionRobot : public RobotType {
public:
    virtual void initialiseHardware() {
        RobotType::initialiseHardware();
    }
    
    virtual size_t getNumConnectors(){
        return connector.size();
    }
    
    virtual size_t getNumDistanceSensors(){
        return distanceSensor.size();
    }
    
    virtual size_t getNumLEDs(){
        return led.size();
    }
    
    virtual size_t getNumIRReceivers(){
        return receiver.size();
    }
    
    virtual size_t getNumIREmitters(){
        return emitter.size();
    }
    
    virtual double getDistanceSensorValue(size_t index){
        return index < distanceSensor.size() ? distanceSensor[index]->getValue() : -1;
    }
    
    virtual bool hasDistanceSensor(size_t index) {
        return index < distanceSensor.size() && distanceSensor[index] != NULL;
    }
    
    virtual bool hasIRReceiver(size_t index) {
        return index < receiver.size() && receiver[index] != NULL;
    }
    
    virtual bool hasIREmitter(size_t index) {
        return index < emitter.size() && emitter[index] != NULL;
    }
    
    virtual bool hasLED(size_t index) {
        return index < led.size() && led[index] != NULL;
    }
    
    virtual bool hasConnector(size_t index) {
        return index < connector.size() && connector[index] != NULL;
    }
    
    virtual LED* getLED(size_t index) {
        return index < led.size() ? led[index] : NULL;
    }
    
    virtual Connector* getConnector(size_t index) {
        return index < connector.size() ? connector[index] : NULL;
    }
    
    virtual Receiver* getIRReceiver(size_t index) {
        return index < receiver.size() ? receiver[index] : NULL;
    }
    
    virtual Emitter* getIREmitter(size_t index) {
        return index < emitter.size() ? emitter[index] : NULL;
    }
    
protected:
    // To be initialised by sub-classes
    std::vector<DistanceSensor*> distanceSensor;
	std::vector<LED*> led;
	std::vector<Receiver*> receiver;
	std::vector<Emitter*> emitter;
	std::vector<Connector*> connector;
};

#endif
